//
//  ZJShareClaimBaseView.m
//  ShangHaiHuDongApp
//
//  Created by ZJ on 2017/6/13.
//  Copyright © 2017年 刘应平. All rights reserved.
//

#import "ZJShareClaimBaseView.h"

@interface ZJShareClaimBaseView ()
/** 下滑线 */
@property (nonatomic, strong) UILabel *underLine;
@end

@implementation ZJShareClaimBaseView

- (instancetype)initWithFrame:(CGRect)frame title:(NSString *)title
{
    self = [super initWithFrame:frame];
    if (self) {
        [self addSubview:self.titleLabel];
        [self addSubview:self.underLine];
        self.titleLabel.text  = title;
        
        self.titleLabel.sd_layout
        .topSpaceToView(self, 0)
        .leftSpaceToView(self, 12 * [UIScreen zj_screenWScale])
        .widthIs([NSString zj_sizeOfString:title font:self.titleLabel.font width:[UIScreen zj_screenWith]].width)
        .heightIs(self.titleLabel.height);
        [self.titleLabel updateLayout];
        
        self.underLine.sd_layout
        .bottomSpaceToView(self, 0)
        .leftSpaceToView(self, 0)
        .rightSpaceToView(self, 0)
        .heightIs(1);
    }
    return self;
}


#pragma mark - Setter


#pragma mark - Getters
- (UILabel *)titleLabel{
    if (_titleLabel == nil){
        _titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(12 * [UIScreen zj_screenWScale], 0, 60 * [UIScreen zj_screenWScale], 44 * [UIScreen zj_screenHScale])];
        _titleLabel.font = [UIFont titleTextFont];
        _titleLabel.textColor = [UIColor zj_colorWithHexString:@"a8a8a8"];
        _titleLabel.textAlignment = NSTextAlignmentRight;
    }
    return _titleLabel;
}

- (UILabel *)underLine{
    if (_underLine == nil){
        _underLine = [UILabel new];
        _underLine.backgroundColor = [UIColor zj_colorWithHexString:@"ebebeb"];
    }
    return _underLine;
}

@end
